function deleteResources(id){
    document.getElementById(id).remove();
}

function  getAbsLeft(obj){
    let   l=obj.offsetLeft;
    while(obj.offsetParent != null){
        obj = obj.offsetParent;
        l += obj.offsetLeft;
    }
    return l;
}

function getAbsTop(obj) {
    let top = obj.offsetTop;
    while (obj.offsetParent != null) {
        obj = obj.offsetParent;
        top += obj.offsetTop;
    }
    return top;
}

function addResources(id){
    const dom = document.getElementById(id)
    const dialog = document.getElementById('dialog')
    // 打开和关闭对话应该抽出方法
    dialog.style.left = getAbsLeft(dom) - 30 +'px';
    dialog.style.top = getAbsTop(dom) + 40 +'px';
    dialog.style.display = 'block'
}